package qaonair1;

//import org.apache.bcel.generic.Select;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class Consultants2 {
	
	FirefoxDriver driver;
	String  baseUrl;
	@Before
	  public void setUp() throws Exception {
		  System.out.println("Hello this is @before every @Test");
	    driver = new FirefoxDriver();
	    baseUrl = "http://qaonair.com/";
	    
	    
	}
@Test 
public void test1() throws Exception {
	
	String vFirstName;
	String vLastName;
	String vEmail;
	String Phone1;
	int iWait;
	String vCountry;
	String ototresults;
	String vtotresults;
	
	
	iWait =2000;
	vFirstName = "Qaoa1";
	vLastName= "codex1";
	vEmail="Qaoa1.codex1@gmail.com";
	Phone1= "1231231111";
	vCountry= "Angola";
	vtotresults="thank you";
	
	
	//consultants1 search  go to qaonair
	 driver.get(baseUrl+ "/work-qa-onair/");
	 Thread.sleep(iWait);
	 //where to enter the text
	 //what to enter
	 try{
	 driver.findElement(By.xpath("//input[@id='inf_field_FirstName']")).clear();
	 driver.findElement(By.xpath("//input[@id='inf_field_FirstName']")).sendKeys(vFirstName);
	 driver.findElement(By.xpath("//input[@id='inf_field_LastName']")).clear();
	 driver.findElement(By.xpath("//input[@id='inf_field_LastName']")).sendKeys(vLastName);
	 driver.findElement(By.xpath("//input[@id='inf_field_Email']")).clear();
	 driver.findElement(By.xpath("//input[@id='inf_field_Email']")).sendKeys(vEmail);
	 driver.findElement(By.xpath("//input[@id='inf_field_Phone1']")).sendKeys(Phone1);
	 
	 Select dd= new Select(driver.findElement(By.xpath("//select[@id='inf_field_Country']")));
	 dd.selectByValue(vCountry);
	 driver.findElement(By.xpath("//html/body/div/div/div/main/article/div/form/p[2]/input")).click();
	 ototresults = driver.findElement(By.xpath("//html/body/div/div/div/main/article/header/h1")).getText();
     System.out.println("Results on AUT"+ ototresults);
	 }catch;
     
     System.out.println("Results on AUT"+ vtotresults);
     
     if(ototresults.equals(vtotresults)) {
    	 System.out.println("pass");
    	 }
     else
     { System.out.println("fail");
     }
     
     
     
     
     
	 
	 
	 Thread.sleep(iWait);
	
}
@After
public void teardown() throws Exception {
	 System.out.println("Hello this is @after every @Test");
	    //driver.quit();
}
}

